//导入路由和路由历史模式组件
import { createRouter, createWebHistory } from "vue-router";

//创建路由实例
const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    name:'login',
    path: '/login',
    component: () => import('@/views/login/index.vue')
  },
  {
    name:'menu',
    path: '/menu',
    component: () => import('@/views/menu/index.vue'),
    //嵌套子路由
    children:[
      {
        name:'home',
        path: '/home',
        component: () => import('@/views/home/index.vue')
      }
    ]
  }
]
const router = createRouter({
  //使用HTML5历史模式
  history: createWebHistory(),
  //定义路由规则
  routes
});

export default router;